package com.test.observe;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Observable;

public class EventSource extends Observable implements Runnable {

	@Override
	public void run() {
		try {
			final InputStreamReader isr = new InputStreamReader(System.in);
			final BufferedReader br = new BufferedReader(isr);
			while (true) {
				System.out.print("\n\rPlease input:");
				String response = br.readLine();
				System.out.println("SetChanged...");
				setChanged();
				System.out.println("Notify...");
				notifyObservers(response);
				System.out.println("Finished.");
			}
		} catch (IOException e) {
			e.printStackTrace();
		}

	}

}
